package com.jiuxian.scheduling.config;

import com.jiuxian.scheduling.config.server.ZKConfigServer;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by wangjingqing on 2017/11/9.
 * @author wangjingqing
 */
public class ConfigServerFactory {

    static Map<String,ConfigServer> serverCopntent = new HashMap<>();

    /**
     * 获取configServer
     * @return ConfigServer
     */
    public static ConfigServer getConfigServer(){
        ConfigServer configServer = serverCopntent.get("configServer");
        if(null == configServer ){
            synchronized (serverCopntent){
                if(configServer == null){
                    configServer =  new ZKConfigServer();
                    serverCopntent.put("configServer",configServer);
                }
            }
        }
        return configServer;
    }
}
